package common;

import java.util.Calendar;
import java.util.Random;

/**
 * MonthPassword
 *
 * @since 2024/6/18
 */
public class PasswordGenerator {
    public static void showPassword(int length) {
        Random random = new Random();
        int max = 9, min = 0;
        for (int i = 0; i < 8; i++) {
            StringBuilder sb = new StringBuilder();
            for (int j = 0; j < length; j++) {
                sb.append(random.nextInt(max - min + 1) + min);
            }
            System.out.println(sb);
        }
    }

    public static void showMonthPasswords() {
        Random random = new Random();
        int max = 9, min = 0, length = 5;
        int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
        for (int i = 0; i < 8; i++) {
            StringBuilder sb = new StringBuilder();
            sb.append(month);
            for (int j = 0; j < length; j++) {
                sb.append(random.nextInt(max - min + 1) + min);
            }
            System.out.println(sb);
        }
    }
}
